BaseStat
	var
		name
		txtShortName
		numBaseValue
		list/lstModifiers = list()
	New(txtName as text, txtShortName as text, numValue as num)
		..()
		if(!txtName)		txtName					= "No Name"
		if(!txtShortName)	txtShortName			= "N/A"
		if(!numValue)		numValue				= 0

		setName(txtName)
		setShortName(txtShortName)
		setBaseValue(numValue)
	proc
		Name(anyOption)
			switch(anyOption)
				if("short") return	getShortName()
				else return 		getName()
		setName(txtVal as text)
			name = txtVal
		setShortName(txtVal as text)
			txtShortName = txtVal
		setBaseValue(numVal as num)
			numBaseValue = numVal
		addMod(txtModType as text, numVal as num)
			var/Modifier/modM = new(txtModType, numVal)
			lstModifiers.Add(modM)
		getName()
			return name
		getShortName()
			return txtShortName
		getBaseValue()
			return numBaseValue
		getValue()
			return getBaseValue()+getMods()
		getMods()
			var/numRetVal		= 0
			var/list/lstL		= getModList()
			for(var/txtMod in lstL)
				//world<<"[mod] = [l[mod]]"
				numRetVal += lstL[txtMod]
			return numRetVal
		getAMod(txtModType)
			var/numRetVal = 0
			for(var/Modifier/modM in lstModifiers)
				if(modM.getModType() == txtModType)
					if(txtModType == "" || uppertext(txtModType)=="DODGE") numRetVal += modM.getModValue()
				else
					//world<<"[m.getModValue()] vs [numRetVal]\..."
					numRetVal = max(numRetVal, modM.getModValue())
					//world<<" = [numRetVal]"
			return numRetVal
		getModList()
			var/list/lstRetVal = list()
			for(var/Modifier/modM in lstModifiers)
				if(lstRetVal.Find(modM.getModType())) continue
				else
					lstRetVal.Add(modM.getModType())
			for(var/txtMod in lstRetVal)
				lstRetVal[txtMod] = getAMod(txtMod)
			return lstRetVal

Attribute
	parent_type = /BaseStat
	proc
		getBonus(txtOption as text)
			switch(txtOption)
				if("base")
					return round(getBaseValue()/2)-5
				else
					return round(getValue()/2)-5

Pool
	parent_type = /BaseStat
	var
		numCurrentValue = 0	//current value (base_val = max)
		atom/atmOwner

	proc
		getMax()
			return getBaseValue()

		doTick()
			numCurrentValue = min(numCurrentValue+getTickValue(),getMax())

		getTickValue()
			return getMax()/10

		setMax(numValue as num)
			setBaseValue(numValue)

		getDisplay()
			return "[getValue()]/[getMax()]"

	getValue()
		return numCurrentValue

	HitPoints
		getTickValue()
			var/Living/livingMob = atmOwner
			return (gameController.getTick()/600)*livingMob.getHeroicLevel()
	ForcePoints

Modifier
	var
		txtModType
		numValue
		anySource
	New(txtType as text, numInitValue as num, anyInitSource as anything)
		..()
		//world<<"T = [t] & V = [v]"
		if(!txtType) txtModType = ""
		else txtModType = txtType
		if(!numInitValue) numValue = 0
		else numValue = numInitValue
		if(anyInitSource) anySource = anyInitSource
	proc
		setModType(txtT as text)
			if(!txtT) txtT=""
			txtModType = txtT
		setModValue(numV as num)
			if(!numV) numV=0
			numValue=numV
		getModType()
			return txtModType
		getModValue()
			return numValue

Defense
	parent_type = /BaseStat
	var
		Living/livingOwner
		txtControl
	New(txtName as text, txtShortName as text, numValue as num, txtC as text, mobO as mob)
		..()
		if(!txtC) txtC="DEX"
		txtControl = txtC
		if(mobO) livingOwner = mobO
	getValue()
		return 10+livingOwner.getAttribute(txtControl,"bonus")+livingOwner.getHeroicLevel()+livingOwner.getDefense(Name("short"))
